/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('umeng-push', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model Alert {
  body?: string(name='body'),
  subtitle?: string(name='subtitle'),
  title?: string(name='title'),
}

model AndroidPayload {
  body?: Body(name='body'),
  displayType?: string(name='displayType'),
  extra?: map[string]any(name='extra'),
  message2ThirdChannel?: Message2ThirdChannel(name='message2ThirdChannel'),
}

model AndroidShortPayload {
  body?: {
    custom?: string(name='custom'),
  }(name='body'),
  extra?: map[string]any(name='extra'),
}

model Aps {
  alert?: Alert(name='alert'),
  badge?: string(name='badge', example='+1(自增)，-1(自减)，4(设置数字)'),
  category?: string(name='category'),
  contentAvailable?: int32(name='contentAvailable'),
  interruptionLevel?: string(name='interruptionLevel'),
  sound?: string(name='sound'),
  threadID?: string(name='threadID'),
}

model Body {
  activity?: string(name='activity'),
  addBadge?: int32(name='addBadge'),
  afterOpen?: string(name='afterOpen'),
  builderId?: long(name='builderId'),
  custom?: string(name='custom'),
  expandImage?: string(name='expandImage'),
  icon?: string(name='icon'),
  img?: string(name='img'),
  playLights?: boolean(name='playLights'),
  playSound?: boolean(name='playSound'),
  playVibrate?: boolean(name='playVibrate'),
  rePop?: int32(name='rePop'),
  setBadge?: int32(name='setBadge'),
  sound?: string(name='sound'),
  text?: string(name='text'),
  title?: string(name='title'),
  url?: string(name='url'),
}

model ChannelProperties {
  channelActivity?: string(name='channelActivity'),
  channelFcm?: string(name='channelFcm'),
  harmonyChannelCategory?: string(name='harmonyChannelCategory'),
  huaweiChannelCategory?: string(name='huaweiChannelCategory'),
  huaweiChannelImportance?: string(name='huaweiChannelImportance'),
  huaweiMessageUrgency?: string(name='huaweiMessageUrgency', example='取值为"NORMAL"和"HIGH",默认为”NORMAL”'),
  mainActivity?: string(name='mainActivity'),
  oppoCategory?: string(name='oppoCategory'),
  oppoChannelId?: string(name='oppoChannelId'),
  oppoNotifyLevel?: string(name='oppoNotifyLevel'),
  useHuaweiMessage?: string(name='useHuaweiMessage', example='"true" ,默认为"false"，可不填'),
  useHuaweiPlainMessage?: string(name='useHuaweiPlainMessage', example='true'),
  vivoAddBadge?: string(name='vivoAddBadge', example='"true",默认"false"'),
  vivoCategory?: string(name='vivoCategory'),
  vivoPushMode?: string(name='vivoPushMode'),
  xiaomiChannelId?: string(name='xiaomiChannelId'),
}

model HarmonyBody {
  action?: string(name='action'),
  addBadge?: int32(name='addBadge'),
  afterOpen?: string(name='afterOpen'),
  bigBody?: string(name='bigBody'),
  custom?: string(name='custom'),
  img?: string(name='img'),
  largeIcon?: string(name='largeIcon'),
  text?: string(name='text'),
  title?: string(name='title'),
  uri?: string(name='uri'),
}

model HarmonyPayload {
  displayType?: string(name='displayType', description='This parameter is required.'),
  extra?: map[string]any(name='extra'),
  harmonyBody?: HarmonyBody(name='harmonyBody'),
}

model IosPayload {
  aps?: Aps(name='aps'),
  extra?: map[string]any(name='extra'),
}

model Message2ThirdChannel {
  setBadge?: long(name='SetBadge'),
  addBadge?: long(name='addBadge'),
  bigBody?: string(name='bigBody'),
  bigTitle?: string(name='bigTitle'),
  expandImage?: string(name='expandImage'),
  img?: string(name='img'),
  sound?: string(name='sound'),
  text?: string(name='text'),
  title?: string(name='title'),
}

model Policy {
  channelStrategy?: map[string]string(name='channelStrategy'),
  expireTime?: string(name='expireTime', example='yyyy-MM-dd HH:mm:ss'),
  outerBizNo?: string(name='outerBizNo'),
  speed?: int32(name='speed', example='5000'),
  startTime?: string(name='startTime', example='yyyy-MM-dd HH:mm:ss'),
}

model CancelByMsgIdRequest {
  msgId?: string(name='MsgId', example='ucj0242167047014687101'),
}

model CancelByMsgIdResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    msgId?: string(name='MsgId', example='ucj0242167047014687101'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='null'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model CancelByMsgIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelByMsgIdResponseBody(name='body'),
}

/**
 * @summary 根据消息ID取消发送
 *
 * @param request CancelByMsgIdRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelByMsgIdResponse
 */
async function cancelByMsgIdWithOptions(request: CancelByMsgIdRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CancelByMsgIdResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.msgId)) {
    body['MsgId'] = request.msgId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CancelByMsgId',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/CancelByMsgId`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 根据消息ID取消发送
 *
 * @param request CancelByMsgIdRequest
 * @return CancelByMsgIdResponse
 */
async function cancelByMsgId(request: CancelByMsgIdRequest): CancelByMsgIdResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return cancelByMsgIdWithOptions(request, headers, runtime);
}

model QueryMsgStatRequest {
  msgId?: string(name='MsgId', example='ufe29y2167046828041801'),
}

model QueryMsgStatResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    accept?: long(name='Accept', example='1'),
    arrive?: long(name='Arrive', example='1'),
    closePush?: long(name='ClosePush', example='0'),
    dismiss?: long(name='Dismiss', example='0'),
    msgId?: string(name='MsgId', example='ufe29y2167046828041801'),
    open?: long(name='Open', example='1'),
    sent?: long(name='Sent', example='1'),
    status?: int32(name='Status', example='2'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='null'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model QueryMsgStatResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryMsgStatResponseBody(name='body'),
}

/**
 * @summary 消息状态查询
 *
 * @param request QueryMsgStatRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryMsgStatResponse
 */
async function queryMsgStatWithOptions(request: QueryMsgStatRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryMsgStatResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.msgId)) {
    body['MsgId'] = request.msgId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryMsgStat',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/QueryMsgStat`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 消息状态查询
 *
 * @param request QueryMsgStatRequest
 * @return QueryMsgStatResponse
 */
async function queryMsgStat(request: QueryMsgStatRequest): QueryMsgStatResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryMsgStatWithOptions(request, headers, runtime);
}

model SendByAliasRequest {
  alias?: string(name='Alias', description='This parameter is required.', example='test'),
  aliasType?: string(name='AliasType'),
  androidPayload?: AndroidPayload(name='AndroidPayload'),
  androidShortPayload?: AndroidShortPayload(name='AndroidShortPayload'),
  channelProperties?: ChannelProperties(name='ChannelProperties'),
  description?: string(name='Description'),
  harmonyPayload?: HarmonyPayload(name='HarmonyPayload'),
  iosPayload?: IosPayload(name='IosPayload'),
  policy?: Policy(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByAliasShrinkRequest {
  alias?: string(name='Alias', description='This parameter is required.', example='test'),
  aliasType?: string(name='AliasType'),
  androidPayloadShrink?: string(name='AndroidPayload'),
  androidShortPayloadShrink?: string(name='AndroidShortPayload'),
  channelPropertiesShrink?: string(name='ChannelProperties'),
  description?: string(name='Description'),
  harmonyPayloadShrink?: string(name='HarmonyPayload'),
  iosPayloadShrink?: string(name='IosPayload'),
  policyShrink?: string(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByAliasResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    msgId?: string(name='MsgId', example='uacxo27167041814609201'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='null'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model SendByAliasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendByAliasResponseBody(name='body'),
}

/**
 * @summary 指定别名发送
 *
 * @param tmpReq SendByAliasRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendByAliasResponse
 */
async function sendByAliasWithOptions(tmpReq: SendByAliasRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SendByAliasResponse {
  Util.validateModel(tmpReq);
  var request = new SendByAliasShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.androidPayload)) {
    request.androidPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidPayload, 'AndroidPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.androidShortPayload)) {
    request.androidShortPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidShortPayload, 'AndroidShortPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.channelProperties)) {
    request.channelPropertiesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.channelProperties, 'ChannelProperties', 'json');
  }
  if (!Util.isUnset(tmpReq.harmonyPayload)) {
    request.harmonyPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.harmonyPayload, 'HarmonyPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.iosPayload)) {
    request.iosPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.iosPayload, 'IosPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.policy)) {
    request.policyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.policy, 'Policy', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.alias)) {
    body['Alias'] = request.alias;
  }
  if (!Util.isUnset(request.aliasType)) {
    body['AliasType'] = request.aliasType;
  }
  if (!Util.isUnset(request.androidPayloadShrink)) {
    body['AndroidPayload'] = request.androidPayloadShrink;
  }
  if (!Util.isUnset(request.androidShortPayloadShrink)) {
    body['AndroidShortPayload'] = request.androidShortPayloadShrink;
  }
  if (!Util.isUnset(request.channelPropertiesShrink)) {
    body['ChannelProperties'] = request.channelPropertiesShrink;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.harmonyPayloadShrink)) {
    body['HarmonyPayload'] = request.harmonyPayloadShrink;
  }
  if (!Util.isUnset(request.iosPayloadShrink)) {
    body['IosPayload'] = request.iosPayloadShrink;
  }
  if (!Util.isUnset(request.policyShrink)) {
    body['Policy'] = request.policyShrink;
  }
  if (!Util.isUnset(request.productionMode)) {
    body['ProductionMode'] = request.productionMode;
  }
  if (!Util.isUnset(request.receiptType)) {
    body['ReceiptType'] = request.receiptType;
  }
  if (!Util.isUnset(request.receiptUrl)) {
    body['ReceiptUrl'] = request.receiptUrl;
  }
  if (!Util.isUnset(request.thirdPartyId)) {
    body['ThirdPartyId'] = request.thirdPartyId;
  }
  if (!Util.isUnset(request.callbackParams)) {
    body['callbackParams'] = request.callbackParams;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendByAlias',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/SendByAlias`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 指定别名发送
 *
 * @param request SendByAliasRequest
 * @return SendByAliasResponse
 */
async function sendByAlias(request: SendByAliasRequest): SendByAliasResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sendByAliasWithOptions(request, headers, runtime);
}

model SendByAliasFileIdRequest {
  aliasType?: string(name='AliasType'),
  androidPayload?: AndroidPayload(name='AndroidPayload'),
  androidShortPayload?: AndroidShortPayload(name='AndroidShortPayload'),
  channelProperties?: ChannelProperties(name='ChannelProperties'),
  description?: string(name='Description'),
  fileId?: string(name='FileId', description='This parameter is required.', example='PF835431668603208261'),
  harmonyPayload?: HarmonyPayload(name='HarmonyPayload'),
  iosPayload?: IosPayload(name='IosPayload'),
  policy?: Policy(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByAliasFileIdShrinkRequest {
  aliasType?: string(name='AliasType'),
  androidPayloadShrink?: string(name='AndroidPayload'),
  androidShortPayloadShrink?: string(name='AndroidShortPayload'),
  channelPropertiesShrink?: string(name='ChannelProperties'),
  description?: string(name='Description'),
  fileId?: string(name='FileId', description='This parameter is required.', example='PF835431668603208261'),
  harmonyPayloadShrink?: string(name='HarmonyPayload'),
  iosPayloadShrink?: string(name='IosPayload'),
  policyShrink?: string(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByAliasFileIdResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    msgId?: string(name='MsgId', example='ucj0242167047014687101'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='null'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model SendByAliasFileIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendByAliasFileIdResponseBody(name='body'),
}

/**
 * @summary 指定别名文件发送
 *
 * @param tmpReq SendByAliasFileIdRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendByAliasFileIdResponse
 */
async function sendByAliasFileIdWithOptions(tmpReq: SendByAliasFileIdRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SendByAliasFileIdResponse {
  Util.validateModel(tmpReq);
  var request = new SendByAliasFileIdShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.androidPayload)) {
    request.androidPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidPayload, 'AndroidPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.androidShortPayload)) {
    request.androidShortPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidShortPayload, 'AndroidShortPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.channelProperties)) {
    request.channelPropertiesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.channelProperties, 'ChannelProperties', 'json');
  }
  if (!Util.isUnset(tmpReq.harmonyPayload)) {
    request.harmonyPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.harmonyPayload, 'HarmonyPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.iosPayload)) {
    request.iosPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.iosPayload, 'IosPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.policy)) {
    request.policyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.policy, 'Policy', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.aliasType)) {
    body['AliasType'] = request.aliasType;
  }
  if (!Util.isUnset(request.androidPayloadShrink)) {
    body['AndroidPayload'] = request.androidPayloadShrink;
  }
  if (!Util.isUnset(request.androidShortPayloadShrink)) {
    body['AndroidShortPayload'] = request.androidShortPayloadShrink;
  }
  if (!Util.isUnset(request.channelPropertiesShrink)) {
    body['ChannelProperties'] = request.channelPropertiesShrink;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.fileId)) {
    body['FileId'] = request.fileId;
  }
  if (!Util.isUnset(request.harmonyPayloadShrink)) {
    body['HarmonyPayload'] = request.harmonyPayloadShrink;
  }
  if (!Util.isUnset(request.iosPayloadShrink)) {
    body['IosPayload'] = request.iosPayloadShrink;
  }
  if (!Util.isUnset(request.policyShrink)) {
    body['Policy'] = request.policyShrink;
  }
  if (!Util.isUnset(request.productionMode)) {
    body['ProductionMode'] = request.productionMode;
  }
  if (!Util.isUnset(request.receiptType)) {
    body['ReceiptType'] = request.receiptType;
  }
  if (!Util.isUnset(request.receiptUrl)) {
    body['ReceiptUrl'] = request.receiptUrl;
  }
  if (!Util.isUnset(request.thirdPartyId)) {
    body['ThirdPartyId'] = request.thirdPartyId;
  }
  if (!Util.isUnset(request.callbackParams)) {
    body['callbackParams'] = request.callbackParams;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendByAliasFileId',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/SendByAliasFileId`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 指定别名文件发送
 *
 * @param request SendByAliasFileIdRequest
 * @return SendByAliasFileIdResponse
 */
async function sendByAliasFileId(request: SendByAliasFileIdRequest): SendByAliasFileIdResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sendByAliasFileIdWithOptions(request, headers, runtime);
}

model SendByAppRequest {
  androidPayload?: AndroidPayload(name='AndroidPayload'),
  androidShortPayload?: AndroidShortPayload(name='AndroidShortPayload'),
  channelProperties?: ChannelProperties(name='ChannelProperties'),
  description?: string(name='Description'),
  harmonyPayload?: HarmonyPayload(name='HarmonyPayload'),
  iosPayload?: IosPayload(name='IosPayload'),
  policy?: Policy(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByAppShrinkRequest {
  androidPayloadShrink?: string(name='AndroidPayload'),
  androidShortPayloadShrink?: string(name='AndroidShortPayload'),
  channelPropertiesShrink?: string(name='ChannelProperties'),
  description?: string(name='Description'),
  harmonyPayloadShrink?: string(name='HarmonyPayload'),
  iosPayloadShrink?: string(name='IosPayload'),
  policyShrink?: string(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByAppResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    msgId?: string(name='MsgId', example='um3zlgb166876370784300'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model SendByAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendByAppResponseBody(name='body'),
}

/**
 * @summary 广播
 *
 * @param tmpReq SendByAppRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendByAppResponse
 */
async function sendByAppWithOptions(tmpReq: SendByAppRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SendByAppResponse {
  Util.validateModel(tmpReq);
  var request = new SendByAppShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.androidPayload)) {
    request.androidPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidPayload, 'AndroidPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.androidShortPayload)) {
    request.androidShortPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidShortPayload, 'AndroidShortPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.channelProperties)) {
    request.channelPropertiesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.channelProperties, 'ChannelProperties', 'json');
  }
  if (!Util.isUnset(tmpReq.harmonyPayload)) {
    request.harmonyPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.harmonyPayload, 'HarmonyPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.iosPayload)) {
    request.iosPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.iosPayload, 'IosPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.policy)) {
    request.policyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.policy, 'Policy', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.androidPayloadShrink)) {
    body['AndroidPayload'] = request.androidPayloadShrink;
  }
  if (!Util.isUnset(request.androidShortPayloadShrink)) {
    body['AndroidShortPayload'] = request.androidShortPayloadShrink;
  }
  if (!Util.isUnset(request.channelPropertiesShrink)) {
    body['ChannelProperties'] = request.channelPropertiesShrink;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.harmonyPayloadShrink)) {
    body['HarmonyPayload'] = request.harmonyPayloadShrink;
  }
  if (!Util.isUnset(request.iosPayloadShrink)) {
    body['IosPayload'] = request.iosPayloadShrink;
  }
  if (!Util.isUnset(request.policyShrink)) {
    body['Policy'] = request.policyShrink;
  }
  if (!Util.isUnset(request.productionMode)) {
    body['ProductionMode'] = request.productionMode;
  }
  if (!Util.isUnset(request.receiptType)) {
    body['ReceiptType'] = request.receiptType;
  }
  if (!Util.isUnset(request.receiptUrl)) {
    body['ReceiptUrl'] = request.receiptUrl;
  }
  if (!Util.isUnset(request.thirdPartyId)) {
    body['ThirdPartyId'] = request.thirdPartyId;
  }
  if (!Util.isUnset(request.callbackParams)) {
    body['callbackParams'] = request.callbackParams;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendByApp',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/SendByApp`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 广播
 *
 * @param request SendByAppRequest
 * @return SendByAppResponse
 */
async function sendByApp(request: SendByAppRequest): SendByAppResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sendByAppWithOptions(request, headers, runtime);
}

model SendByDeviceRequest {
  androidPayload?: AndroidPayload(name='AndroidPayload'),
  androidShortPayload?: AndroidShortPayload(name='AndroidShortPayload'),
  channelProperties?: ChannelProperties(name='ChannelProperties'),
  description?: string(name='Description'),
  deviceTokens?: string(name='DeviceTokens', description='This parameter is required.', example='ArdNyIzFCH2K3szXA8arpu0Y7ywOdA67mCSumtpnMnmf'),
  harmonyPayload?: HarmonyPayload(name='HarmonyPayload'),
  iosPayload?: IosPayload(name='IosPayload'),
  policy?: Policy(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByDeviceShrinkRequest {
  androidPayloadShrink?: string(name='AndroidPayload'),
  androidShortPayloadShrink?: string(name='AndroidShortPayload'),
  channelPropertiesShrink?: string(name='ChannelProperties'),
  description?: string(name='Description'),
  deviceTokens?: string(name='DeviceTokens', description='This parameter is required.', example='ArdNyIzFCH2K3szXA8arpu0Y7ywOdA67mCSumtpnMnmf'),
  harmonyPayloadShrink?: string(name='HarmonyPayload'),
  iosPayloadShrink?: string(name='IosPayload'),
  policyShrink?: string(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByDeviceResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    msgId?: string(name='MsgId', example='ula4wbu166876119986400'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='内部错误'),
  requestId?: string(name='RequestId', example='74808AA4-A044-102F-8F5F-AFE4D97A0F26'),
  success?: boolean(name='Success', example='true'),
}

model SendByDeviceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendByDeviceResponseBody(name='body'),
}

/**
 * @summary 指定设备发送
 *
 * @param tmpReq SendByDeviceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendByDeviceResponse
 */
async function sendByDeviceWithOptions(tmpReq: SendByDeviceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SendByDeviceResponse {
  Util.validateModel(tmpReq);
  var request = new SendByDeviceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.androidPayload)) {
    request.androidPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidPayload, 'AndroidPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.androidShortPayload)) {
    request.androidShortPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidShortPayload, 'AndroidShortPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.channelProperties)) {
    request.channelPropertiesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.channelProperties, 'ChannelProperties', 'json');
  }
  if (!Util.isUnset(tmpReq.harmonyPayload)) {
    request.harmonyPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.harmonyPayload, 'HarmonyPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.iosPayload)) {
    request.iosPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.iosPayload, 'IosPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.policy)) {
    request.policyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.policy, 'Policy', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.androidPayloadShrink)) {
    body['AndroidPayload'] = request.androidPayloadShrink;
  }
  if (!Util.isUnset(request.androidShortPayloadShrink)) {
    body['AndroidShortPayload'] = request.androidShortPayloadShrink;
  }
  if (!Util.isUnset(request.channelPropertiesShrink)) {
    body['ChannelProperties'] = request.channelPropertiesShrink;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.deviceTokens)) {
    body['DeviceTokens'] = request.deviceTokens;
  }
  if (!Util.isUnset(request.harmonyPayloadShrink)) {
    body['HarmonyPayload'] = request.harmonyPayloadShrink;
  }
  if (!Util.isUnset(request.iosPayloadShrink)) {
    body['IosPayload'] = request.iosPayloadShrink;
  }
  if (!Util.isUnset(request.policyShrink)) {
    body['Policy'] = request.policyShrink;
  }
  if (!Util.isUnset(request.productionMode)) {
    body['ProductionMode'] = request.productionMode;
  }
  if (!Util.isUnset(request.receiptType)) {
    body['ReceiptType'] = request.receiptType;
  }
  if (!Util.isUnset(request.receiptUrl)) {
    body['ReceiptUrl'] = request.receiptUrl;
  }
  if (!Util.isUnset(request.thirdPartyId)) {
    body['ThirdPartyId'] = request.thirdPartyId;
  }
  if (!Util.isUnset(request.callbackParams)) {
    body['callbackParams'] = request.callbackParams;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendByDevice',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/SendByDevice`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 指定设备发送
 *
 * @param request SendByDeviceRequest
 * @return SendByDeviceResponse
 */
async function sendByDevice(request: SendByDeviceRequest): SendByDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sendByDeviceWithOptions(request, headers, runtime);
}

model SendByDeviceFileIdRequest {
  androidPayload?: AndroidPayload(name='AndroidPayload'),
  androidShortPayload?: AndroidShortPayload(name='AndroidShortPayload'),
  channelProperties?: ChannelProperties(name='ChannelProperties'),
  description?: string(name='Description'),
  fileId?: string(name='FileId', description='This parameter is required.', example='PF835431668603208261'),
  harmonyPayload?: HarmonyPayload(name='HarmonyPayload'),
  iosPayload?: IosPayload(name='IosPayload'),
  policy?: Policy(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByDeviceFileIdShrinkRequest {
  androidPayloadShrink?: string(name='AndroidPayload'),
  androidShortPayloadShrink?: string(name='AndroidShortPayload'),
  channelPropertiesShrink?: string(name='ChannelProperties'),
  description?: string(name='Description'),
  fileId?: string(name='FileId', description='This parameter is required.', example='PF835431668603208261'),
  harmonyPayloadShrink?: string(name='HarmonyPayload'),
  iosPayloadShrink?: string(name='IosPayload'),
  policyShrink?: string(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByDeviceFileIdResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    msgId?: string(name='MsgId', example='ufe29y2167046828041801'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='null'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model SendByDeviceFileIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendByDeviceFileIdResponseBody(name='body'),
}

/**
 * @summary 指定设备文件发送
 *
 * @param tmpReq SendByDeviceFileIdRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendByDeviceFileIdResponse
 */
async function sendByDeviceFileIdWithOptions(tmpReq: SendByDeviceFileIdRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SendByDeviceFileIdResponse {
  Util.validateModel(tmpReq);
  var request = new SendByDeviceFileIdShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.androidPayload)) {
    request.androidPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidPayload, 'AndroidPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.androidShortPayload)) {
    request.androidShortPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidShortPayload, 'AndroidShortPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.channelProperties)) {
    request.channelPropertiesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.channelProperties, 'ChannelProperties', 'json');
  }
  if (!Util.isUnset(tmpReq.harmonyPayload)) {
    request.harmonyPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.harmonyPayload, 'HarmonyPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.iosPayload)) {
    request.iosPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.iosPayload, 'IosPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.policy)) {
    request.policyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.policy, 'Policy', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.androidPayloadShrink)) {
    body['AndroidPayload'] = request.androidPayloadShrink;
  }
  if (!Util.isUnset(request.androidShortPayloadShrink)) {
    body['AndroidShortPayload'] = request.androidShortPayloadShrink;
  }
  if (!Util.isUnset(request.channelPropertiesShrink)) {
    body['ChannelProperties'] = request.channelPropertiesShrink;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.fileId)) {
    body['FileId'] = request.fileId;
  }
  if (!Util.isUnset(request.harmonyPayloadShrink)) {
    body['HarmonyPayload'] = request.harmonyPayloadShrink;
  }
  if (!Util.isUnset(request.iosPayloadShrink)) {
    body['IosPayload'] = request.iosPayloadShrink;
  }
  if (!Util.isUnset(request.policyShrink)) {
    body['Policy'] = request.policyShrink;
  }
  if (!Util.isUnset(request.productionMode)) {
    body['ProductionMode'] = request.productionMode;
  }
  if (!Util.isUnset(request.receiptType)) {
    body['ReceiptType'] = request.receiptType;
  }
  if (!Util.isUnset(request.receiptUrl)) {
    body['ReceiptUrl'] = request.receiptUrl;
  }
  if (!Util.isUnset(request.thirdPartyId)) {
    body['ThirdPartyId'] = request.thirdPartyId;
  }
  if (!Util.isUnset(request.callbackParams)) {
    body['callbackParams'] = request.callbackParams;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendByDeviceFileId',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/SendByDeviceFileId`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 指定设备文件发送
 *
 * @param request SendByDeviceFileIdRequest
 * @return SendByDeviceFileIdResponse
 */
async function sendByDeviceFileId(request: SendByDeviceFileIdRequest): SendByDeviceFileIdResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sendByDeviceFileIdWithOptions(request, headers, runtime);
}

model SendByFilterRequest {
  androidPayload?: AndroidPayload(name='AndroidPayload'),
  androidShortPayload?: AndroidShortPayload(name='AndroidShortPayload'),
  channelProperties?: ChannelProperties(name='ChannelProperties'),
  description?: string(name='Description'),
  filter?: string(name='Filter', example='"where":{"and":[{"or":[{"app_version":">=1.0"}]}]}'),
  harmonyPayload?: HarmonyPayload(name='HarmonyPayload'),
  iosPayload?: IosPayload(name='IosPayload'),
  policy?: Policy(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByFilterShrinkRequest {
  androidPayloadShrink?: string(name='AndroidPayload'),
  androidShortPayload?: AndroidShortPayload(name='AndroidShortPayload'),
  channelPropertiesShrink?: string(name='ChannelProperties'),
  description?: string(name='Description'),
  filter?: string(name='Filter', example='"where":{"and":[{"or":[{"app_version":">=1.0"}]}]}'),
  harmonyPayloadShrink?: string(name='HarmonyPayload'),
  iosPayloadShrink?: string(name='IosPayload'),
  policyShrink?: string(name='Policy'),
  productionMode?: boolean(name='ProductionMode', example='true'),
  receiptType?: int32(name='ReceiptType'),
  receiptUrl?: string(name='ReceiptUrl', example='https://msg.umeng.com/upush/receipt'),
  thirdPartyId?: string(name='ThirdPartyId'),
  callbackParams?: string(name='callbackParams'),
}

model SendByFilterResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    msgId?: string(name='MsgId', example='usouag1167056659161101'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='null'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model SendByFilterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendByFilterResponseBody(name='body'),
}

/**
 * @summary 根据筛选条件发送
 *
 * @param tmpReq SendByFilterRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendByFilterResponse
 */
async function sendByFilterWithOptions(tmpReq: SendByFilterRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SendByFilterResponse {
  Util.validateModel(tmpReq);
  var request = new SendByFilterShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.androidPayload)) {
    request.androidPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.androidPayload, 'AndroidPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.channelProperties)) {
    request.channelPropertiesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.channelProperties, 'ChannelProperties', 'json');
  }
  if (!Util.isUnset(tmpReq.harmonyPayload)) {
    request.harmonyPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.harmonyPayload, 'HarmonyPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.iosPayload)) {
    request.iosPayloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.iosPayload, 'IosPayload', 'json');
  }
  if (!Util.isUnset(tmpReq.policy)) {
    request.policyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.policy, 'Policy', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.androidPayloadShrink)) {
    body['AndroidPayload'] = request.androidPayloadShrink;
  }
  if (!Util.isUnset(request.androidShortPayload)) {
    body['AndroidShortPayload'] = request.androidShortPayload;
  }
  if (!Util.isUnset(request.channelPropertiesShrink)) {
    body['ChannelProperties'] = request.channelPropertiesShrink;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.filter)) {
    body['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.harmonyPayloadShrink)) {
    body['HarmonyPayload'] = request.harmonyPayloadShrink;
  }
  if (!Util.isUnset(request.iosPayloadShrink)) {
    body['IosPayload'] = request.iosPayloadShrink;
  }
  if (!Util.isUnset(request.policyShrink)) {
    body['Policy'] = request.policyShrink;
  }
  if (!Util.isUnset(request.productionMode)) {
    body['ProductionMode'] = request.productionMode;
  }
  if (!Util.isUnset(request.receiptType)) {
    body['ReceiptType'] = request.receiptType;
  }
  if (!Util.isUnset(request.receiptUrl)) {
    body['ReceiptUrl'] = request.receiptUrl;
  }
  if (!Util.isUnset(request.thirdPartyId)) {
    body['ThirdPartyId'] = request.thirdPartyId;
  }
  if (!Util.isUnset(request.callbackParams)) {
    body['callbackParams'] = request.callbackParams;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendByFilter',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/SendByFilter`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 根据筛选条件发送
 *
 * @param request SendByFilterRequest
 * @return SendByFilterResponse
 */
async function sendByFilter(request: SendByFilterRequest): SendByFilterResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sendByFilterWithOptions(request, headers, runtime);
}

model UploadDeviceRequest {
  deviceTokens?: string(name='DeviceTokens', example='device_token_1\\\\ndevice_token_2\\\\ndevice_token_3\\\\n...
alias1\\\\nalias2\\\\nalias3\\\\n...'),
}

model UploadDeviceResponseBody = {
  code?: string(name='Code', example='0'),
  data?: {
    fileId?: string(name='FileId', example='PF835431668603208261'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='null'),
  requestId?: string(name='RequestId', example='86C4236B-D6C2-1E31-8370-2FAEC5CFE012'),
  success?: boolean(name='Success', example='true'),
}

model UploadDeviceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UploadDeviceResponseBody(name='body'),
}

/**
 * @summary 上传设备列表创建设备文件
 *
 * @param request UploadDeviceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UploadDeviceResponse
 */
async function uploadDeviceWithOptions(request: UploadDeviceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UploadDeviceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.deviceTokens)) {
    body['DeviceTokens'] = request.deviceTokens;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UploadDevice',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/UploadDevice`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 上传设备列表创建设备文件
 *
 * @param request UploadDeviceRequest
 * @return UploadDeviceResponse
 */
async function uploadDevice(request: UploadDeviceRequest): UploadDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return uploadDeviceWithOptions(request, headers, runtime);
}

